#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<queue>
#define N 100005
using namespace std;
int sum,n,m;
struct node{
	int a,b;
	int id;
}num[N];
int f1[N];
int f2[N];
bool cmp(node x,node y){
	if(x.a!=y.a)return x.a<y.a;
	else return x.b<y.b;
}
bool operator <(node x,node y){
	return x.b>y.b;
}
priority_queue<node>q;
int tot;
int need1[N],need2[N];
int main(){
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	scanf("%d%d%d",&sum,&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&num[i].a,&num[i].b);
		num[i].id=i;
	}
	sort(num+1,num+n+1,cmp);
	tot=0;
	for(int i=1;i<=n;i++){
		bool flag=0;
		int x=0;
		while(q.size()&&q.top().b<=num[i].a){
			x=max(x,need1[q.top().id]);
			flag=1;
			q.pop(),tot--;
		}
		q.push(num[i]);
		tot++;
		if(!flag)x=tot;
		f1[x]++;
		need1[i]=x;
	}
	for(int i=1;i<=n;i++){
		f1[i]=f1[i-1]+f1[i];
//		cout<<f1[i]<<" ";
	}
//	cout<<endl;
	while(q.size())q.pop();
	
	for(int i=1;i<=m;i++){
		scanf("%d%d",&num[i].a,&num[i].b);
		num[i].id=i;
	}
	sort(num+1,num+m+1,cmp);
	tot=0;
	for(int i=1;i<=m;i++){
		bool flag=0;
		int x=0;
		while(q.size()&&q.top().b<=num[i].a){
			x=max(x,need2[q.top().id]);
			flag=1;
			q.pop(),tot--;
		}
		q.push(num[i]);
		tot++;
		if(!flag)x=tot;
		f2[x]++;
		need2[i]=x;
	}
	for(int i=1;i<=m;i++){
		f2[i]=f2[i-1]+f2[i];
//		cout<<f2[i]<<" ";
	}
//	cout<<endl;
	while(q.size())q.pop();
	
	int ans=0;
	for(int i=0;i<=sum;i++){
		ans=max(ans,f1[i]+f2[sum-i]);
	}
	printf("%d",ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}
